package com.one.consumer.reserve.presenter;

import android.content.Context;

import com.one.common.model.http.callback.ObserverOnResultListener;
import com.one.common.presenter.BaseApiPresenter;
import com.one.common.utils.list.ListUtils;
import com.one.common.view.base.BaseActivity;
import com.one.common.view.base.IListView;
import com.one.consumer.reserve.model.ReserveModel;
import com.one.consumer.reserve.model.item.CaseItem;
import com.one.consumer.reserve.model.item.ProgramItem;
import com.one.consumer.reserve.model.item.ProjectTypeItem;

import java.util.ArrayList;

/**
 * author ：zhulunjun
 * email  ：zhulunjun@qq.com
 * date   ：2018/10/21 下午9:16
 * description ：
 **/
public class DECaseListPresenter extends BaseApiPresenter<IListView, ReserveModel> {
    public DECaseListPresenter(IListView mView, Context mContext) {
        super(mView, mContext, new ReserveModel((BaseActivity) mContext));
    }


    /**
     * 获取案例列表
     */
    public void getCaseListDE(){
        mModel.getCaseListDE(mView.getPage()+"", new ObserverOnResultListener<ArrayList<CaseItem>>() {
            @Override
            public void onResult(ArrayList<CaseItem> objects) {
                if(ListUtils.isNotEmpty(objects) && mView!=null){
                    mView.loadSuccess(objects);
                }
            }
        });
    }

    /**
     * 获取户型列表
     */
    public void getProjectTypeList(String id){
        mModel.getProjectTypeList(id, new ObserverOnResultListener<ArrayList<ProjectTypeItem>>() {
            @Override
            public void onResult(ArrayList<ProjectTypeItem> projectTypeItems) {
                if(mView!=null){
                    mView.loadSuccess(projectTypeItems);
                }
            }
        });
    }

    /**
     * 获取户型列表
     */
    public void getProjectProgramList(String id){
        mModel.getProjectProgramList(id, new ObserverOnResultListener<ArrayList<ProgramItem>>() {
            @Override
            public void onResult(ArrayList<ProgramItem> programItems) {
                if(mView!=null){
                    mView.loadSuccess(programItems);
                }
            }
        });
    }
}
